{% load static %}

<div id="editormd">   
    <textarea name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% if widget.value %}{{ widget.value }}{% endif %}</textarea>

</div>

<script>
    function initEditorMD() {
        EDITORMD = editormd("editormd", 
            {{% for key, value in config.items %} {% autoescape off %} {% if key == "toolbarHandlers"%} 
                {{key}} : { 
                {% for inner_key, inner_value in  value.items %} {{ inner_key }} : {{ inner_value }}, {% endfor %} 
                }, {% else %} 
                {{key}} : {{value}}, {% endif %} {% endautoescape %} {% endfor %}
            }
        );
    }
</script>
